<?php /*a:1:{s:58:"C:\wamp64\www\tp\app\admin\view\zhusu\reportforms\look.php";i:1697162142;}*/ ?>
<div class="layui-fluid">   
    <div class="layui-card">
    
            <div  style="font-weight:700;">
               <h2 style=" text-align: center;padding-top: 8px;"> 注塑车间生产日报表</h2>  <h3 style=" float:right;padding-right: 100px;padding-bottom: 8px;">日期： <?php echo htmlentities($date); ?></h2>
            </div>
     
        <div class="layui-card-body" >
            <table lay-filter="zhusushenpi" id="zhusushenpi">

            <script type="text/html" id="toolbarDemo1">
              <div class="layui-btn-container" >
                <button class="layui-btn layui-btn-sm" id='top-zhusu-shenhe' style='<?php if( $roleid==3){ echo "display:none;";} ?>'>提交审核</button>
                
              </div>
            </script>
            </table>
        </div>
        
    </div>
</div>
<!--JS部分-->
<script type="text/javascript">
layui.use(['zTree','buildItems', ], function(){
    var app_root = layui.cache.maps +'zhusu.reportforms/';
    var layer=layui.layer,table=layui.table,form=layui.form,admin=layui.admin;
    /*数据表渲染*/
   
    table.render({
        elem: '#zhusushenpi',
        toolbar: '#toolbarDemo1' ,
        title: '注塑车间生产日报表',
        cols: [[
            {type:'checkbox',fixed:'left'},
            {field:'class',edit:'text',width:55,align:'center',title:'班次'},
            {field:'order_id',edit:'text',width:95,align:'center',title:'订单号'},
            {field:'product_id',edit:'text',width:200,align:'center',title:'产品名称'},
            {field:'number',edit:'text',width:70,align:'center',title:'机台编号'},
            {field:'unit',edit:'text',width:70,align:'center',title:'单位'},
            {field:'material_id',edit:'text',width:70,align:'center',title:'用料'},
            {field:'colour_id',edit:'text',width:80,align:'center',title:'颜色/色粉'},
            {field:'order_number',edit:'text',width:110,align:'center',title:'订单数量(总数)'},
            {field:'qualified_quantity',edit:'text',width:120,align:'center',title:'生产合格数量(日)'},
            {field:'working_hours',edit:'text',width:120,align:'center',title:'实际生产工时(日)'},
            {field:'scrapped_part',edit:'text',width:100,align:'center',title:'残品数量(日)'},
            {field:'operator',edit:'text',width:80,align:'center',title:'操作工'},
            {field:'accumulate_number',edit:'text',width:100,align:'center',title:'合格累计数量'},
            {field:'debugging_time',edit:'text',width:100,align:'center',title:'换模调试时间'},
            {field:'change_material_time',edit:'text',width:100,align:'center',title:'换料烘料时间'},
            {field:'abnormal_time',edit:'text',width:100,align:'center',title:'其他异常事件'},
            {field:'weight',edit:'text',width:100,align:'center',title:'产品单重'},
            {field:'abnormal_time',edit:'text',width:180,align:'center',title:'其他异常事件'},
            {field:'remarks',edit:'text',width:180,align:'center',title:'备注'},
        ]],
        url: app_root+"look?do=json",
        page: true,
        limit:<?php echo htmlentities($limit); ?>
    });/**/
    /*顶部添加按钮*/
    $('#top-zhusu-shenhe').on('click',function(){Open();});/**/
    /*顶部删除按钮*/
    $('#top-zhusu-delshenhe').on('click', function(){
        var checkRows = table.checkStatus('zhusu').data;
        if(checkRows.length === 0){return layer.msg('请选择需删除的内容');}
        var ids = checkRows.map(function(d){return d.id;});
        del(ids);
    });/**/
    /*快编监听*/
    table.on('edit(zhusushenpi)',function(obj){
        admin.req(app_root+"edit?do=up",{id:obj.data.id,av:obj.value,af:obj.field},function(res){
            layer.msg(res.msg,{shade:[0.4,'#000'],time:1500},function(){
                if(res.code==1) table.reloadData('zhusu');
            });
        },'post',{headersToken:true});
        
    });/**/
   
    /*工具条监听*/
    table.on('tool(zhusushenpi)', function(obj){
        var data = obj.data;
        console.log(data);
    });/**/

    /*删除*/
    function del(ids){
        layer.confirm('确定要删除所选内容吗？', function(){
            admin.req(app_root+"del",{id:ids},function(res){
                layer.msg(res.msg,{shade:[0.4,'#000'],time:1500},function(){
                    if(res.code==1) table.reloadData('zhusu');
                });
            },'post',{headersToken:true});
        });
    }/**/
       /*弹出窗*/
       function Open(Dt){
        admin.open({
            type: 1,
            bid: 'zhusu_items',
            btn: ['保存', '取消'],
            area: ['600px', '30%'],
            title:'审核',
    
            success: function(l,index){
                var height = l.height() - 260;

                layui.buildItems.build({
                    bid: 'zhusu_items',
                    data: [
                        {name:"shenpiid",title:"审核选项",type:"html",html:'<input type="radio" name="shenpiid" value="1" title="审核通过" checked><input type="radio" name="shenpiid" value="0" title="审核不通过" >'},
                        {name:"shenpicontent",title:"审批意见",type:"textarea",value:'',placeholder:"审批意见"},
                    ]
                });


                form.on('submit(zhusu_items)',function(data){
                  
                    var checkRows = table.checkStatus('zhusushenpi').data;

                    if(checkRows.length==0 ){ 

                        layer.msg('请选择审批内容！');  layer.close(index);

                    }else{

                            data.field.checkRows=checkRows;
                           // console.log(data.field.shenpiid);
                                admin.req(app_root+"look?do=shenpi",data.field,function(res){
                                layer.msg(res.msg,{shade:[0.4,'#000'],time:1500},function(){
                                    console.log(res);
                                    if(res.code==1){
                                        layer.close(index);
                                        table.reloadData('zhusushenpi');
                                    }
                                  
                                });
                            },'post',{headersToken:true});
                            return false;
                            
                    }
                       
                });

                
            }
        });
    }/**/
});
</script>